package com.gopay.bis.gdb.ebank.gfbank.payment.merchant;

import java.io.FileInputStream;
import java.io.IOException;

public class SM2SignUtil {
	
	private static final int BUFFSIZE = 0x10000;
	public static final String PUKFILE=".puk";
	public static final String PVKFILE=".pvk";
	
	/**
	 * 读取密钥
	 * @param filePath
	 * @return
	 * @throws IOException
	 */
	public static final byte[] read(String filePath) throws IOException {
		FileInputStream crls;
		if (filePath == null) {
			throw new IllegalArgumentException("Illegal Argument: filePath");
		}
		crls = null;
		byte abyte0[];
		try {
			crls = new FileInputStream(filePath);
			byte out[] = new byte[crls.available()];
			byte buffer[] = new byte[BUFFSIZE];
			int rLength;
			for (int offset = 0; (rLength = crls.read(buffer, 0, buffer.length)) != -1; offset += rLength) {
				System.arraycopy(buffer, 0, out, offset, rLength);
			}
			abyte0 = out;
		} catch (IOException e) {
			throw e;
		} finally {
			if (crls != null) {
				try {
					crls.close();
				} catch (Exception e) {
				}
			}
		}
		return abyte0;
	}

}
